//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class NumberRecord : CellValueRecord
    {
        private double _value;

        public NumberRecord(double value, Cell cell, BiffWriterWorkbookContext context): base(cell, context)
        {
            this._value = value;
        }

        public NumberRecord()
        {
        }

        protected override void WriteValue(BinaryWriter writer)
        {
            writer.Write(_value);
        }

        protected override void ReadValue(BinaryReader reader, int length)
        {
            _value = reader.ReadDouble();
        }

        protected override object GetValue(BiffReaderWorkbookContext context)
        {
            return _value;
        }

        internal override BiffRecordType RecordType
        {
            get { return BiffRecordType.Number;}
        }
    }
}